<include file="../header" />
<style>
	.delete{
		background: url(/statics/images/x_alt.png)no-repeat right;
		background-size: cover;
		width: 16px;
		height: 16px;
		position: absolute;
		top: 0;
		right: 0;
	}
</style>
<script type="text/javascript" src="/Template/js/vue.min.js"></script>

<body class="J_scroll_fixed" id="container">
        <script type="text/javascript">

            $(function() {

				var app = new Vue({
					el: '#container',
					data: {
					},
					methods: {
						removeImage: function (index) {
						}
					}
				});

                var description = UE.getEditor('description',{
                    initialFrameHeight:300,
                    initialContent : "",
                    serverUrl :'{:U("activity/ueditorUpload")}'
                });
                
                $("button#upload").click(function(){
                     //上传文件
                   $.ajaxFileUpload({
                       url:"{:U('common/uploadImage')}",//处理图片脚本
                       secureuri :false,
                       fileElementId :'fileToUpload',//file控件id
                       dataType : 'json',
					   data: {
						   name: 'fileToUpload'
					   },
                       success : function (data, status){
						   $("input[name=titleImage]").val(data.url);
						   $("img[name=preShow]").attr("src", data.url);
                       },
                       error: function(data, status, e){
						   alert(e);
                       }
                   })
               	});

				$("button#upload1").click(function(){
					//上传文件
					$.ajaxFileUpload({
						url:"{:U('common/uploadImage')}",//处理图片脚本
						secureuri :false,
						fileElementId :'images',//file控件id
						dataType : 'json',
						data: {
							name: "images"
						},
						success : function (data, status){
							app.photoList.push(data.url);
						},
						error: function(data, status, e){
							alert(e);
						}
					})
				});
               
               	$("button.btn_submit").click(function() {

                   	$("input[name=description]").val(description.getContent());
                   
                   	$("form").submit();
                   
               	})

            })
            
        </script>
		<script type="text/javascript"  src="__TMP__/assets/js/ueditor/ueditor.config.js"></script>
        <script type="text/javascript"  src="__TMP__/assets/js/ueditor/ueditor.all.min.js"></script>
	<div class="wrap jj">
		<div class="common-form">
			<form method="post" class="form-horizontal J_ajaxForm" action="{:U('case/addCasePost')}">
				<fieldset>
					<input type="hidden" name="caseId" value="{$caseId}">
					<input type="hidden" name="photoJson">
					<div class="control-group">
						<label class="control-label">标题：</label>
						<div class="controls">
							<input type="text" class="input" name="title" value="">
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">标题图片:</label>
						<div class="controls">
							<input id="fileToUpload" type="file" name="fileToUpload" style="width:170px;">
							<button type="button" class="btn btn-primary" id="upload">上传</button>
							<input type="hidden" name="titleImage" />
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">标题图片预览:</label>
						<div class="controls">

							<img src="" name="preShow" style="width:250px;height:150px;" />
							<div class="delete"></div>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">疾病：</label>
						<div class="controls">
							<input type="text" class="input" name="disease" value="">
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">类型：</label>
						<div class="controls">
							<input type="text" class="input" name="type" value="">
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">排序：</label>
						<div class="controls">
							<input type="text" class="input" name="index" value="">
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">内容：</label>
						<div class="controls">
							<input type="hidden" name="description" />
							<script type="text/plain" id="description" name="description"></script>
						</div>
					</div>
                                    
				</fieldset>
				<div class="form-actions">
					<button type="button" class="btn btn-primary btn_submit">添加</button>
					<a class="btn" href="__URL__">返回</a>
				</div>
			</form>
		</div>
	</div>
	<script src="__ROOT__/statics/js/common.js"></script>
</body>
</html>